buildconfig

Grails use config.properties value into BuildConfig.groovy

早过忘川 提交于 2019-12-01 13:42:52
I have a config.properties file under conf directory. and have a entry in the above file like this: grails.tomcat.version = 2.2.4 . How can I use this value in BuildConfig.groovy file? Suppose: plugins = { build ":tomcat:{here i want to use the config value}" } You can do read the properties file as below: plugins { def props = new Properties() new File("grails-app/conf/config.properties").withReader{ props.load(it) } def slurp = new ConfigSlurper().parse(props) build ":tomcat:$slurp.grails.tomcat.version" } I do not see a value out of it if you only have that single entry to use from the

Grails use config.properties value into BuildConfig.groovy

隐身守侯 提交于 2019-12-01 12:48:10
问题 I have a config.properties file under conf directory. and have a entry in the above file like this: grails.tomcat.version = 2.2.4 . How can I use this value in BuildConfig.groovy file? Suppose: plugins = { build ":tomcat:{here i want to use the config value}" } 回答1: You can do read the properties file as below: plugins { def props = new Properties() new File("grails-app/conf/config.properties").withReader{ props.load(it) } def slurp = new ConfigSlurper().parse(props) build ":tomcat:$slurp

#if debug --> #if myOwnConfig?

蓝咒 提交于 2019-11-30 02:36:42
is there a way in c# to use a custom Configuration like "#if DEBUG" I need a "#if OFFLINE" as my Build-Config's name is "Offline" (only for further debug-purposes too)... Thanks! Build -> Configuration manager -> Active solution configuration -> New... Create a new configuration "Offline". Project -> Properties -> Build -> Configuration -> Offline Conditional compilation symbols: type OFFLINE Save project. Yes, you can. But before you can, follow these steps: In Visual Studio, go to Properties -> Build. At the configuration dropdown, select "Offline" Add "OFFLINE" to the "Conditional

Gradle buildConfigField BuildConfig cannot resolve symbol

最后都变了- 提交于 2019-11-29 22:00:29
I am using Gradle to build my Android application. I am trying to use some flags based on the build type (release or debug). My Gradle file looks like this: android { buildTypes { debug { buildConfigField 'boolean', 'PREPROD', 'true' buildConfigField 'boolean', 'STAGING', 'false' } release { buildConfigField 'boolean', 'PREPROD', 'false' buildConfigField 'boolean', 'STAGING', 'false' } } } And if I try to call BuildConfig.PREPROD or BuildConfig.STAGING I get a "Cannot resolve symbol" error. The Gradle sync was successful, so I don't know if I forgot some steps in order to be able to use this

Cannot resolve symbol c882c94be45fff9d16a1cf845fc16ec5

江枫思渺然 提交于 2019-11-29 03:13:41
问题 I am a new developer exploring the world of Android. I am currently working through the Udacity tutorials for creating the Sunshine app. In the fragment activity class in order to get data from openweathermap I must add the API key I got from my account to the end of the generated URL. There is a call to BuildConfig.java in the Fragment activity (click to see the call to BuildConfig.java which is on the 6th line as part of String apiKey). The build.gradle file is as follows: apply plugin:

Gradle buildConfigField BuildConfig cannot resolve symbol

南楼画角 提交于 2019-11-28 18:14:49
问题 I am using Gradle to build my Android application. I am trying to use some flags based on the build type (release or debug). My Gradle file looks like this: android { buildTypes { debug { buildConfigField 'boolean', 'PREPROD', 'true' buildConfigField 'boolean', 'STAGING', 'false' } release { buildConfigField 'boolean', 'PREPROD', 'false' buildConfigField 'boolean', 'STAGING', 'false' } } } And if I try to call BuildConfig.PREPROD or BuildConfig.STAGING I get a "Cannot resolve symbol" error.

Gradle : how to use BuildConfig in an android-library with a flag that gets set in an app

折月煮酒 提交于 2019-11-28 16:15:11
问题 My (gradle 1.10 and gradle plugin 0.8)-based android project consists of a big android-library that is a dependency for 3 different android-apps In my library, I would love to be able to use a structure like this if (BuildConfig.SOME_FLAG) { callToBigLibraries() } as proguard would be able to reduce the size of the produced apk, based on the final value of SOME_FLAG But I can't figure how to do it with gradle as : * the BuildConfig produced by the library doesn't have the same package name

Best Way to Include Debug Code?

久未见 提交于 2019-11-28 04:53:34
I am programming Android applications, and the best way here may or may not be the same as Java in general. I simply want to be able to set a debug flag that will only execute certain portions of code when it's set to true––equiv to C++ setting a preprocessor #define DEBUG and using #ifdef DEBUG. Is there an accepted or best way to accomplish this in Java? Right now I'm just going to set a variable in my Application object, but I don't imagine this is the best way. That's the way I do it: // in some.class.with.Constants public static final boolean DEV_MODE = true; // in some other class import

BuildConfig not getting created correctly (Gradle Android)

拟墨画扇 提交于 2019-11-27 21:29:40
问题 I am trying to convert our Android application to a gradle build. I have the project and it's libraries building successfully. I am now trying to create separate apks for our various environments (dev/test/prod have different urls for the restful services they consume). In searching around, the best way that I feel to do this is with making different BuildConfig for each environment. This is what I tried: import java.util.regex.Pattern buildscript { repositories { mavenCentral() }

Best Way to Include Debug Code?

耗尽温柔 提交于 2019-11-27 05:30:46
问题 I am programming Android applications, and the best way here may or may not be the same as Java in general. I simply want to be able to set a debug flag that will only execute certain portions of code when it's set to true––equiv to C++ setting a preprocessor #define DEBUG and using #ifdef DEBUG. Is there an accepted or best way to accomplish this in Java? Right now I'm just going to set a variable in my Application object, but I don't imagine this is the best way. 回答1: That's the way I do it