hagu

Kotlin configuration file for multiplatform.

License

License

GroupId

GroupId

com.karumi.hagu
ArtifactId

ArtifactId

hagu
Last Version

Last Version

0.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

hagu
Kotlin configuration file for multiplatform.
Project URL

Project URL

https://github.com/Karumi/Hagu
Source Code Management

Source Code Management

https://github.com/Karumi/hagu

Download hagu

How to add to project

<!-- https://jarcasting.com/artifacts/com.karumi.hagu/hagu/ -->
<dependency>
    <groupId>com.karumi.hagu</groupId>
    <artifactId>hagu</artifactId>
    <version>0.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.karumi.hagu/hagu/
implementation 'com.karumi.hagu:hagu:0.1.1'
// https://jarcasting.com/artifacts/com.karumi.hagu/hagu/
implementation ("com.karumi.hagu:hagu:0.1.1")
'com.karumi.hagu:hagu:jar:0.1.1'
<dependency org="com.karumi.hagu" name="hagu" rev="0.1.1">
  <artifact name="hagu" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.karumi.hagu', module='hagu', version='0.1.1')
)
libraryDependencies += "com.karumi.hagu" % "hagu" % "0.1.1"
[com.karumi.hagu/hagu "0.1.1"]

Dependencies

runtime (2)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.50
junit : junit jar 4.12

test (1)

Group / Artifact Type Version
com.karumi.kotlinsnapshot : core jar 2.1.1

Project Modules

There are no modules declared in this project.

Build Status

Gradle plugin to enable build configuration secrets for Kotlin, Kotlin-Native / Multiplatform.

Adding to your project

Add our Gradle Plugin to your build.gradle file:

buildscript {
    repositories {
        mavenCentral()
    }
    
    dependencies {       
        classpath 'com.karumi.hagu:hagu:0.1.2'
    }
}

apply plugin: 'com.karumi.hagu'

kotlin.sourceSets["main"].kotlin.srcDirs("$buildDir/generated/kotlin/config")

If you want to use it in Kotlin Multiplatform you must change main for commonMain or the source directory name you are using it.

Add configuration file

Hagu by default uses gradle.properties file to add the key-value configuration you want like this:

api_key = "some_api_key"
number_key = 11

Use your configuration file

First you must build your project, ./gradlew build, it generates the HaguConfig kotlin object with the property constants you added in gradle.properties.

import com.karumi.hagu.generated.HaguConfig

println(HaguConfig.API_KEY)  //output: some_api_key

Profiles

You can build your project with different build configuration profiles having different property files, for example:

debug.properties
release.properties
ci.properties

To select one of those profiles, you need to add a profile parameter with the name of the profile file, for example, debug.

./gradlew build -Pprofile=debug

Default profile

If you want to select a default profile instead of gradle.properties you can add the following Hagu configuration:

hagu {
    defaultProfile = "debug"
}

This configuration will use debug.properties by default, you can always override this behavior if you add the profile parameter.

License

Copyright 2019 Karumi

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.
com.karumi.hagu

Karumi

Karumi, the Rock Solid Code studio

Versions

Version
0.1.1