Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7167057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:30:56+00:00 2026-05-28T14:30:56+00:00

In my project build definition the SettingKey useProguard in the Android scope is set

  • 0

In my project build definition the SettingKey useProguard in the Android scope is set to true. This is what I want by default. When I execute one particular task, however, I want useProguard to be false. Everything in the Android scope comes from the sbt-android-plugin.

I’m not sure how best to solve this problem. From what I read it seems like a command can get the job done, since it can execute a task with a different state than what your current session sees. I tried to create such a command like so:

def buildWithoutProguard = Command.command("build-without-proguard") { state =>
  val extracted = Project.extract(state)
  import extracted._

  val transformed = session.mergeSettings :+ (useProguard in Android := false)
  val newStructure = Load.reapply(transformed, structure)
  val newState = Project.setProject(session, newStructure, state)
  Project.evaluateTask(buildAndRun, newState)
  state
}

I’m appending the command to my project settings and running the ‘build-without-proguard’ command executes the buildAndRun task as desired. However, useProguard is still true instead of false as I would expect.

First, this whole approach feels heavy handed to me. Assuming changing sbt-android-plugin isn’t an option here then how else would I solve this problem?

Second, why doesn’t this approach work as is?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:30:56+00:00Added an answer on May 28, 2026 at 2:30 pm

    From what I understand from your question, you want the setting to be different for a dependency depending on what is depending on it. This doesn’t make sense — a dependency either is satisfied or it isn’t, and what depends on it doesn’t come into the equation.

    Your solution seems satisfactory to me. An alternative would be making two projects, pointing to the same source, but with different proguard settings and different target, so one would build with and the other without proguard, and both would keep their state. You’d then do whatever you want just switching the projects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can we set the build settings for different targets in the project build settings
I want to build a developer build project and then needs to publish it
I have a project that is build up from several OSGi bundles. One of
We have a TFS build definition set up where we pass the following extra
We have several project collections in TFS2010 and one particular collection is getting the
Build started 16/11/2011 9:24:11 AM. Project C:\Builds\1\NetTellerMigration\NetTellerMigrationBuild\Sources\blah.sln on node 1 (default targets). ValidateSolutionConfiguration: Building
I want to use TFS Team Build, and have created a build definition. The
We have several independent builds (each independent build is a multi-project build). The main
I wish to create a zip archive of my target directory (${project.build.directory). using the
I'm working on a class project to build a little Connect4 game in Java.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.