All Projects → Morfly → airin

Morfly / airin

Licence: Apache-2.0 license
A framework for automated migration of your projects to Bazel build system.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to airin

bzl
Bzl - Integrated CLI + UI + VSCode Extension for Bazel
Stars: ✭ 43 (+104.76%)
Mutual labels:  build, bazel
Bazel
a fast, scalable, multi-language and extensible build system
Stars: ✭ 17,790 (+84614.29%)
Mutual labels:  build, bazel
real-world-bazel
Bazel build files collected from real-world GitHub projects
Stars: ✭ 24 (+14.29%)
Mutual labels:  build, bazel
Angular Bazel Example
MOVED to the bazel nodejs monorepo 👉
Stars: ✭ 354 (+1585.71%)
Mutual labels:  build, bazel
Please
High-performance extensible build system for reproducible multi-language builds.
Stars: ✭ 1,856 (+8738.1%)
Mutual labels:  build, bazel
Bazel Watcher
Tools for building Bazel targets when source files change.
Stars: ✭ 245 (+1066.67%)
Mutual labels:  build, bazel
Bazel Remote
A remote cache for Bazel
Stars: ✭ 260 (+1138.1%)
Mutual labels:  build, bazel
Awesome Bazel
A curated list of Bazel rules, tooling and resources.
Stars: ✭ 640 (+2947.62%)
Mutual labels:  build, bazel
Tutorial Ubuntu 18.04 Install Nvidia Driver And Cuda And Cudnn And Build Tensorflow For Gpu
Ubuntu 18.04 How to install Nvidia driver + CUDA + CUDNN + build tensorflow for gpu step by step command line
Stars: ✭ 91 (+333.33%)
Mutual labels:  build, bazel
Buildbuddy
BuildBuddy is an open source Bazel build event viewer, result store, and remote cache.
Stars: ✭ 182 (+766.67%)
Mutual labels:  build, bazel
Tensorflow-binaries
Tensorflow GNU/Linux, MacOS binaries compiled with SSE4.1, SSE4.2 and AVX
Stars: ✭ 14 (-33.33%)
Mutual labels:  build, bazel
netlify-plugin-cache
⚡ Generic plugin for caching any files and/or folders between Netlify builds
Stars: ✭ 19 (-9.52%)
Mutual labels:  build
wsjcpp
Yet another... C++ Source Package Manager
Stars: ✭ 18 (-14.29%)
Mutual labels:  build
build
Build system scripts based on GENie (https://github.com/bkaradzic/genie) project generator
Stars: ✭ 30 (+42.86%)
Mutual labels:  build
autosetup
A better, faster autoconf replacement
Stars: ✭ 60 (+185.71%)
Mutual labels:  build
migration-tooling
Migration tools for Bazel
Stars: ✭ 40 (+90.48%)
Mutual labels:  bazel
grab-bazel-common
Common rules and macros for Grab's Android projects built with Bazel.
Stars: ✭ 20 (-4.76%)
Mutual labels:  bazel
ngp
New Go Package
Stars: ✭ 22 (+4.76%)
Mutual labels:  build
micromamba-docker
Rapid builds of small Conda-based containers using micromamba.
Stars: ✭ 97 (+361.9%)
Mutual labels:  build
icon-pipeline
🚚 SVG icon pipeline - Optimize icons & build SVG sprites
Stars: ✭ 43 (+104.76%)
Mutual labels:  build

Airin

Maven Central

Airin is a framework for automated migration of your projects to Bazel build system. It consists of 2 primary components:

  • Starlark Template Engine - a declarative, typesafe Starlark template engine and code generator. Define templates for your Bazel configuration files in Kotlin DSL which closely resembles Starlark itself. Check the documentation to learn more.
  • Automated Migration Component - a plugin to the build system of your project (Gradle) for automating its migration to Bazel. Define the set of Bazel file templates for your project and configure Airin Gradle plugin to migrate the project. Check the documentation to learn more.

Publications

How it works?

Step 1

In buildSrc directory define a set of Starlark templates for your project.

fun java_build(
    targetName: String,
    srcRoot: String,
    mainClass: String
    /**
     *
     */
) = BUILD.bazel {
    load("@rules_java//java:defs.bzl", "java_binary")

    java_binary(
        name = targetName,
        srcs = glob("$srcRoot/**/*.java"),
        main_class = mainClass,
        deps = list["//library"]
    )
}

Step 2

Also, in buildSrc implement TemplateProvider's for each type of your Gradle modules to correctly map the right templates to the right modules.

Step 3

In root build.gradle file configure Airin Gradle plugin by registering your newly created template providers for each type of modules or usecases.

Kotlin
airin {
  
  templates {
    
    register<Workspace>()
    register<KotlinModuleBuild>()
    register<AndroidModuleBuild>()
  }
}
Groovy
airin {
  
  templates {
    
    register Workspace
    register KotlinModuleBuild
    register AndroidModuleBuild
  }
}

In the example above Workspace, KotlinModuleBuild and AndroidModuleBuild are Starlark code template providers that implement GradleTemplateProvider interface.

Step 4

Run the migration.

./gradlew migrateToBazel

See the documentation to learn more about the migration process.

Installation

Migration from Gradle

In the buildSrc/build.gradle file add the following:

dependencies {
    // Gradle plugin.
    implementation "org.morfly.airin:airin-gradle:0.4.0"
  
    // Optional - Android specific extensions.
    implementation "org.morfly.airin:airin-gradle-android:0.4.0"
    // Optional. Required for airin-gradle-android.
    runtimeOnly("com.android.tools.build:gradle:<version>")
    // Optional. Required for projects that use Jetpack Compose.
    runtimeOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:<version>")
}

Then, in the root build.gradle file apply Airin Gradle plugin:

plugins {
    id "org.morfly.airin"
}

Standalone Template Engine

In case you need only Starlark code generator:

dependencies {
    // Starlark template engine.
    implementation "org.morfly.airin:airin-starlark:0.4.0"
    // Collection of common rules and functions.
    implementation "org.morfly.airin:airin-starlark-stdlib:0.4.0"
  
    // Optional - Starlark rules and functions generator.
    ksp "org.morfly.airin:airin-starlark-libgen:0.4.0"
}

Don't forget to add id("com.google.devtools.ksp") to plugins section of your build.gradle(.kts) file if you are using ksp.


Now you are ready for the migration.

Also, learn more about generating DSL for custom rules and functions.

Examples

Learn more about Airin by checking example projects.

License

Copyright 2021 Pavlo Stavytskyi

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].